package com.sinodata.bsm.center.engine.event.worker;

import com.sinodata.bsm.center.bean.ResBean;
import com.sinodata.bsm.center.engine.event.EventWorker;
import com.sinodata.bsm.center.engine.process.ProcessEngine;
import com.sinodata.bsm.common.constants.EventConstants;
import com.sinodata.bsm.common.vo.Event;

/**
 * <p>
 * Description:
 * </p>
 *
 * @author liulibo
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2013-4-15 下午4:25:39          liulibo        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
public class ProcessWorker implements EventWorker {

    public ProcessWorker() {

    }

    @Override
    public void execute(Event event) {
        ResBean resBean = ResBean.get(event.getResId());
        //故障类事件&&新事件&&资源未删除
        if ((event.getCatalog() == EventConstants.CATALOG_FAULTEVENT && event.getStatus() == EventConstants.STATUS_NEW) && (resBean != null && resBean.res().getDeleted() != 1)) {
            ProcessEngine.sendProcess(event);
        }
    }

}
